<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      角色详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="自增主键：">
          <span>{{formData.id}}</span>
        </el-form-item>
        <el-form-item label="部门id：">
          <span>{{formData.dept_id}}</span>
        </el-form-item>
        <el-form-item label="角色名称：">
          <span>{{formData.role_name}}</span>
        </el-form-item>
        <el-form-item label="排序：">
          <span>{{formData.sort}}</span>
        </el-form-item>
        <el-form-item label="备注：">
          <span>{{formData.note}}</span>
        </el-form-item>
        <el-form-item label="用逗号隔开的key：">
          <span>{{formData.role_menu}}</span>
        </el-form-item>
        <el-form-item label="用逗号隔开的key：">
          <span>{{formData.role_permissions}}</span>
        </el-form-item>
        <el-form-item label="0=禁用 1=启用：">
          <span>{{formData.status}}</span>
        </el-form-item>
        <el-form-item label="1=默认 0=非默认：">
          <span>{{formData.init_default}}</span>
        </el-form-item>
        <el-form-item label="管理端=1：">
          <span>{{formData.user_type}}</span>
        </el-form-item>
        <el-form-item label="用户组id：">
          <span>{{formData.group_id}}</span>
        </el-form-item>
        <el-form-item label="数据版本字段：">
          <span>{{formData.version_id}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  qr_sys_roleInfo
} from '@/api/project/wmyw/project_wmyw_qr_sys_role'
export default {
  name: "a_wmywa_qr_sys_role_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        id: 0, 
        dept_id: 0, 
        role_name: '', 
        sort: 0, 
        note: '', 
        role_menu: '', 
        role_permissions: '', 
        status: 0, 
        init_default: 0, 
        user_type: 0, 
        group_id: 0, 
        version_id: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      qr_sys_roleInfo({id:id}).then(r=>{
        this.formData.id = r.dataSingle.id, 
        this.formData.dept_id = r.dataSingle.dept_id, 
        this.formData.role_name = r.dataSingle.role_name, 
        this.formData.sort = r.dataSingle.sort, 
        this.formData.note = r.dataSingle.note, 
        this.formData.role_menu = r.dataSingle.role_menu, 
        this.formData.role_permissions = r.dataSingle.role_permissions, 
        this.formData.status = r.dataSingle.status, 
        this.formData.init_default = r.dataSingle.init_default, 
        this.formData.user_type = r.dataSingle.user_type, 
        this.formData.group_id = r.dataSingle.group_id, 
        this.formData.version_id = r.dataSingle.version_id, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
